<!--
  // Creation History
  // --------------------------------------------------------------
  //	Company:			HTHK
  //	NAME:				WeeklyExceptionReport.jsp
  //	TITLE:				
  //	FUNCTION:			
  //	BY:					Beyes Xia
  //	DATE:				2004-4-8 20:46
  // --------------------------------------------------------------
-->

<html>
<%@ include file="../tssheader.jsp" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.*" %>
<%
    
	String begin_date = request.getParameter("date_from");
	String end_date = request.getParameter("date_to");
	String staff_name = "";

	ArrayList week = (ArrayList)request.getAttribute("week");
	ArrayList staffNo = (ArrayList)request.getAttribute("staffNo");
	ArrayList staffName = (ArrayList)request.getAttribute("staffName");
	HashMap spend = (HashMap)request.getAttribute("spend");

	if(staffName.size() == 1)
		staff_name = (String)staffName.get(0);
	
%>
<body>
<h2>Weekly Report</h2>
<table>
<tr>		
	<td>Date From: </td>
	<td><%= begin_date %></td>
</tr>
<tr>
	<td>Date To: </td>
	<td><%= end_date %></td>
</tr>
</table>

<br>

<table border=1>

<tr>
	<td nowrap>
		<b>Staff No.</b>
	</td>
	<td nowrap>
		<b>Staff Name</b>
	</td>
<%
	for(int i=0;i<week.size();i++)
	{
%>
	<td nowrap>
		<b><%= week.get(i) %></b>
	</td>
<%	}	%>
</tr>

<%
     
	for(int i=0;i<staffNo.size();i++)
	{
%>
<tr>
	<td nowrap align='right'>
		<%= staffNo.get(i) %>
	</td>
	<td nowrap>
		<%= staffName.get(i) %>
	</td>
<%		
		for(int j=0;j<week.size();j++)
		{
			String spendHours = "";
			boolean flag = false;
			if(spend.get(staffNo.get(i)+"~"+week.get(j))!= null){
				spendHours = String.valueOf(((HashMap)spend.get(staffNo.get(i)+"~"+week.get(j))).get("spend"));
				flag = (Boolean)((Map)spend.get(staffNo.get(i)+"~"+week.get(j))).get("flag");
			}else
				spendHours = "&nbsp";
			
			if(spendHours.equals("&nbsp"))
			{								
%>
	<td nowrap style="background:#B0C4DE;" align=right>
		<font color=#000000><%= spendHours %></font>
	</td>
<%		
			}
			else
			{
				float spendHoursF = Float.parseFloat(spendHours);
				if(!flag)
				{
%>
	<td nowrap style="background:#B0C4DE;" align=right>
		<font color=#000000><b><%= spendHours %><b></font>
	</td>
<%
				}
				else
				{
%>
	<td nowrap align=right>
		<%= spendHours %>
	</td>
<%
				}
			}
		}
%>	
</tr>
<%	}	%>

</table>

<br>
<hr>
<p>
<INPUT type=button value=Back onclick="location.href='<%=contextPath%>/tss/weeklyexceptionreport/WeeklyExceptionExport.jsp'">
</p>
</body>
<%@ include file="../tssfooter.jsp" %>
</html>

